﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sinacor.Servico.Bovespa.Calendario.Service.ServiceImplementation.Translator.BusinessEntityToDataContract
{
    public class CalendarioBolsa
    {
        public DataContract.Response.CalendarioResponse ToCalendarioResponse(BusinessEntity.Calendario from)
        {
            DataContract.Response.CalendarioResponse to = null;

            if (from != null)
            {
                to = new DataContract.Response.CalendarioResponse();

                to.CodigoPraca = from.CodigoPraca;
                to.DataPregao = from.DataPregao;
                to.TipoDia = from.TipoDia;
            }

            return to;
        }

        public List<DataContract.Response.CalendarioResponse> ToCalendarioResponse(List<BusinessEntity.Calendario> from)
        {
            List<DataContract.Response.CalendarioResponse> to = null;

            if (from != null)
            {
                to = new List<DataContract.Response.CalendarioResponse>();

                foreach (BusinessEntity.Calendario item in from)
                {
                    to.Add(ToCalendarioResponse(item));
                }
            }

            return to;
        }
    }
}
